package lab02.test21;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {

        int count = 0;
        Scanner sc  = new Scanner(System.in);

        System.out.println("请输入一个字符串：");
        String string = sc.nextLine();

        System.out.println("请输入要统计的字符：");
        String countChar =sc.nextLine();

        for (int i= 0;i<string.length();i++){
            if(string.charAt(i) == countChar.charAt(0)){
                count++;
            }
        }

        System.out.println("\""+countChar+"\""+"共出现了"+count+"次！");
    }
}
